# 使用nodejs
FROM node:alpine as builder

# 设置工作目录
WORKDIR /app

# 复制package.json和package-lock.json文件到指定目录
COPY package*.json ./

# 安装依赖
RUN yarn install

# 复制所有文件到工作目录
COPY . .

# 打包
RUN yarn run build

# 使用nginx运行
FROM nginx:stable-alpine

# 配置nginx
COPY /nginx/default.conf /etc/nginx/conf.d/

# 复制静态文件到nginx工作目录
COPY --from=builder /app/dist /usr/share/nginx/html

# 对外暴露8080端口
EXPOSE 80

# 启动nginx容器
CMD ["nginx","-g","deamon off;"]


